home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8701 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: gramercy.ios.com!mdebiase
  2. From: mdebiase@gramercy.ios.com (Mark)
  3. Newsgroups: comp.databases.oracle,comp.lang.c++
  4. Subject: Re: Pro*C DB access routines with C++
  5. Followup-To: comp.databases.oracle,comp.lang.c++
  6. Date: 26 Feb 1996 02:58:47 GMT
  7. Organization: Internet Online Services
  8. Message-ID: <4gr7l7$9oh@news2.ios.com>
  9. References: <4g6vjv$gvv@news1.halcyon.com> <4gcf0c$e02@relay2.uk.mdis.com> <4gf5id$jec@boell.softcon.de>
  10. NNTP-Posting-Host: gramercy.ios.com
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Uwe Steffen (us@SoftcoN.de) wrote:
  14. : In article <4gcf0c$e02@relay2.uk.mdis.com>,
  15. :     100610.52@compuserve.com (Balakrishna Avula) writes:
  16. : >danubius@coho.halcyon.com () wrote:
  17. : >
  18. : >>I've been trying to find a book covering this subject to no avail so
  19. : >>far.  
  20. : >
  21. : >>I have a C++ project that will need a bunch of Pro*C ORACLE DB access
  22. : >>routines.  I'd like to wrap these routines in C++ classes, but being
  23. : >>fairly new at both, I could use some help from published books on this
  24. : >>subject, or example source code.
  25.  
  26. : Hi,
  27. : it's a little bit tricky to start with, however solvable.
  28. : 1) You have to use PRO*C 1.6 instead of PRO*C 2.*, because
  29. :    PRO*C 1.6 does not scan the entire file, only statements that
  30. :    start with 'EXEC SQL'.
  31.  
  32. Actually, Proc*C 2.0 in Oracle 7.1.4 and above can be used with option
  33. PARSE=NONE as this will cause the precompiler to work in text substitution
  34. mode like 1.6 (I believe this option was not available prior to 7.1.4).
  35.  
  36. : 2) our .ec-files are called '*.ec', so we use the following rule to create
  37. :    object-files:
  38. :    .ec.o:
  39. :        $(ESQL) INAME=$*.ec ONAME=$*.c $(ESQLFLAGS)
  40. :        sed -f ../changec_C.sed $*.c >$*.C
  41. :        $(RM) $*.EC
  42. :        $(RM) $*.c
  43. :        $(CC) -c $(FLAGS) $*.C
  44. :    The sed-scripts does some postprocessing to correct
  45. :    some incompatibilitys.
  46. :    changec_C.sed:
  47. : 1,$s/char  filnam\[.*\]/char  filnam\[31\]/
  48. : /extern sqlcex(*/d
  49. : /extern sqlora(*/d
  50. : /extern sqlbuf(*/d
  51. : /extern sqlcte(*/d
  52. : /extern sqlcx2(*/d
  53. : /extern    sqliem(*/d
  54. :    You will have to put extern "C" { ... } -wrappers around function-
  55. :    prototypes in oracle-headerfiles.
  56.  
  57. : Good luck
  58. : Uwe Steffen
  59.  
  60.  
  61. Mark
  62.